<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>考试系统</title>
    
    <style type="text/css">
<!--
body {
	margin-left: 3px;
	margin-top: 0px;
	margin-right: 3px;
	margin-bottom: 0px;
}
.STYLE1 {
	color: #e1e2e3;
	font-size: 12px;
}
.STYLE6 {color: #000000; font-size: 12; }
.STYLE10 {color: #000000; font-size: 12px; }
.STYLE19 {
	color: #344b50;
	font-size: 12px;
}
.STYLE21 {
	font-size: 12px;
	color: #3b6375;
}
.STYLE22 {
	font-size: 12px;
	color: #295568;
}
-->
</style>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link type="text/css" href="<%=basePath %>/css/jquery-ui-1.8.17.custom.css" rel="stylesheet" />
    <link type="text/css" href="<%=basePath %>/css/jquery-ui-timepicker-addon.css" rel="stylesheet" />
 	<script type="text/javascript" src="<%=basePath %>/js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="<%=basePath %>/js/jquery-ui-1.8.17.custom.min.js"></script>
    <script type="text/javascript" src="<%=basePath %>/js/jquery-ui-timepicker-addon.js"></script>
    <script type="text/javascript" src="<%=basePath %>/js/jquery-ui-timepicker-zh-CN.js"></script>
    
    <script type="text/javascript">
    $(function () {
        $(".ui_timepicker").datetimepicker({
            //showOn: "button",
            //buttonImage: "./css/images/icon_calendar.gif",
            //buttonImageOnly: true,
            changeMonth: true,  
            changeYear: true ,
            showSecond: true,
            timeFormat: 'hh:mm:ss',
            stepHour: 1,
            stepMinute: 1,
            stepSecond: 1
        })
    })
    
    var flag = true;
        function check(){
        	flag = true;
        	$("#info").text("");
        	var name = $.trim($("#name").val());
        	var begintime = $("#btime").val();
        	var endtime = $("#etime").val();
        	if(name.length == 0 || begintime.length == 0 || endtime.length ==0){
        		flag = false;
        		$("#info").text("请将信息填写完整");
        		return  ;
        	}
        	
        	begintime = new Date(begintime.replace(/-/ig,'/'));
        	endtime = new Date(endtime.replace(/-/ig,'/'));
        	
        	if(endtime <= begintime){
        		alert("time errror");
        		$("#info").text("请填写正确时间");
        		flag=false;
        		return  ;
        	}
        	
        }
        
        
        function go(){
        	 check();
        	if(flag){
        		$("#paperEdit").submit();
        	}
        	else{
        		$("#info").text("信息填写有误");
        	}
        }
    </script>

  </head>
  
  <body>
  
  <form name="form1" id="paperEdit" action="<%=path %>/Paper/PaperAction!PaperEditInfo.action" method="post">
	<table width="30%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
		<tr>
			 <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">考试编号 </span></div></td>
			 <td height="20" bgcolor="d3eaef" class="STYLE19"><div align="center">${paper.id } <input type="hidden" name="paper.id" value='<s:property value="paper.id"/>' readonly /> </div></td>
		</tr>
		<tr>
			 <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">考试名称</span></div></td>
			 <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left"> <input type="text" name="paper.papername" id="name" size="35" value="<s:property value='paper.papername'/>"/> </div></td>
		</tr>
		<tr>
			 <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">开始时间</span></div></td>
			 <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left" > 			
			 <input type="text" name="paper.begintime" id="btime"  class="ui_timepicker" value="<s:property value='paper.begintime'/>">
			 </div></td>
		</tr>
		<tr>
			 <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">结束时间</span></div></td>
			 <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left"> 
			<input type="text" name="paper.endtime" id="etime"  class="ui_timepicker" value="<s:property value='paper.endtime'/>">
			 </div></td>
		</tr>
		<tr>
			 <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">类型</span></div></td>
			 <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left"> 
			 <s:if test="paper.isjava == 0">
			 	<select name="paper.isjava">
			 		<option value="0" selected>java</option>
			 		<option value="1">c</option>
			 	</select>
			 </s:if>
			 	<s:else>
			 	<select name="paper.isjava">
			 		<option value="0" >java</option>
			 		<option value="1" selected>c</option>
			 	</select>
			 </s:else>
			  </div></td>
		</tr>
		<tr>
			 <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">考试密码</span></div></td>
			 <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left"> <input type="text" name="paper.paperpw" value="<s:property value='paper.paperpw'/>" /> </div></td>
		</tr>
		
		<tr>
             <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">是否安排排名</span></div></td>
             <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left"> 
	             <s:if test="paper.rank == 1">
	                <select name="paper.rank">
	                   <option value="1" selected >是</option>
	                   <option value="0" >否</option>
	               </select> 
	             </s:if>
	               <s:else>
	                <select name="paper.rank">
	                   <option value="1" >是</option>
	                   <option value="0" selected>否</option>
	               </select>
	             </s:else>
             </div></td>
        </tr>
		
		<tr>
			<td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10"> <input type="button" value="提交" onclick ="go()"/></span></div></td>
		</tr>
		
		<tr><td colspan="2" > <div id ="info" style="color: red; background-color: white;text-align: center" ></div> </td></tr>
		
	</table>
	</form>
	
	<a href="<%=request.getContextPath()%>/Teacher/TeacherAction!editPaperPrograms.action?id=${paper.id }">试卷题目修改</a>
    
  </body>
</html>
